<?php
include_once("../../../common/module/checkA.php");
include_once("../../../../config.php");
include_once("../controller/collect.php"); 
?>


<?
//用来判断当前系统属于什么板块
$system_part = $plate['mid'];

if(!$_REQUEST ['applydate'])
{
    $_REQUEST ['applydate']=date("Y-m");
}
$applydate  = addslashes($_REQUEST['applydate']);


$full_finance=select_lines_all_items($table_Prefix."finance","","","")

?>


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns="http://www.w3.org/1999/html">
<head>
        <?php include ROOT_PATH_.'/controller/common/module/head.php'; ?>
    <?php include 'modules/head.php'; ?>
    <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/echarts/5.4.2/echarts.min.js"></script>



    <style>
        body>.detail-staitics-info .agent-list li{font-size: 12px!important; width:100px;}
        body>.detail-staitics-info .layui-table td, .layui-table th{font-size: 12px!important;}
    </style>








</head>

<body>

<div id="topbar">   <?php include ROOT_PATH_.'/controller/common/module/topbar.php'; ?></div>

<div id="container" class="<? echo $system_part ?>">

    <div id="maincontent">

        <div id="sidebar">
            <?php include ROOT_PATH_.'/controller/common/module/sidebar.php'; ?>
        </div>




        <div id="content">
            <h1>财务汇总</h1>


            <!-- 用$system_part .list_boxes来控制来到确认板块信息显示-->
            <div class="list-box">







<div class="detail-staitics-info"  >







        <h2>财务目标</h2>
        <div class="shrinker" >年度业绩加护。涉及分红计划，多种统计因素综合。</div>
        <div class="layui-form">
            <table class="layui-table">
                <colgroup>
                    <col width="100">
                    <col>
                    <col>
                    <col>
                    <col>
                </colgroup>
                <thead>
                <tr>
                    <th>年度</th>
                    <th>年生产日数详情<br/>入职的人上班的时间清单</th>
                    <th>总生产日<br/>入职的人上班的时间加在一起</th>

                    <th>去年总生产日<br/>去年入职的人上班的时间加在一起</th>

                    <th>当前年收益<br/>今年财务的收入</th>
                    <th>目标年收益<br/>期望今年财务的收入（单人率计）</th>
                    <th>年收益差距<br/>期望总收入和实际总收入的差距</th>

                    <th>实际平均日产<br/>今年收益/今年的生产日数</th>
                    <th>目标平均日产<br/>今年期望收益/今年的生产日数</th>
                    <th>日产差距<br/>期望日产和实际日产的差距</th>


                    <th>和去年对比<br/>单以公司收入，不计算人数</th>
<!--                    <th>总收益同比<br/>单以公司收入，不计算人数</th>-->
                </tr>
                </thead>
                <tbody>

                <?
                for($ii=0;$ii<5;$ii++){
                    //这里提前设置一下需要用到的数值
                    $year_this=date("Y",strtotime(-$ii." year "));
                    $year_last=date("Y",strtotime(-($ii+1)." year "));

                    $income_last_year=sum_total($table_Prefix."finance","cost","applydate like '".date("Y",strtotime(-($ii+1)." year "))."%' and status = '过账'  and cost > 0");
                    $income_this_year=sum_total($table_Prefix."finance","cost","applydate like '".date("Y",strtotime(-$ii." year "))."%' and status = '过账'  and cost > 0");
                    ?>
                    <tr>
                        <td><?echo $year_this ?></td>




                        <td>
<!--                            统计年未离职的（包含当年入职）-->
                            <? $emp01=select_lines_all_items($table_Prefix."employee","",
                                "(applydate < '".$year_this."-01-01' or applydate like '%".$year_this."%') and
                                 (leavedate > '".$year_this."-12-31' or leavedate = '0000-00-00 00:00:00')"  ,"") ;?>
                            <?
//                            echo count($emp01)."人 】<br/>";
                               //这里应该循环每个人的入职日期，直到最后一日，看应该计算多少天
                               $work_unit=array();
                               foreach($emp01 as $k=>$v)
                               {
                                   //echo $v['name'].":".substr($v['applydate'],0,10)."_".substr($v['leavedate'],0,10)."<br/>";
                                   //非此年入职，计算全年
                                   if($v['applydate']<$year_this."-01-01")
                                   {
                                       $work_unit[]=365;
                                   }
                                   else//此年入职，需要年末减去入职时间
                                   {

                                       $work_unit[]=count_days($v['applydate'],$year_this."-12-31");
                                       //$_work_unit=count_days($v['applydate'],$year_this."-12-31");

                                       //因为php版本问题。bow只5.3版本，不支持cout_period的函数。

//                                        $_work_unit = count_period($v['applydate'],$year_this."-12-31");
//                                       print_r2($_work_unit);
//                                        $work_unit[] = $_work_unit[6];

                                       //echo $v['name']."这年入职".$_work_unit."<br/>";
                                   }

                               }

                           echo array_sum($work_unit);
                          ?>








<!--                            统计年离职的-->
                            <? $emp02=select_lines_all_items($table_Prefix."employee","","leavedate > '".$year_this."-01-01' and leavedate < '".$year_this."-12-31'"  ,"") ;?>
                            <?
                            //echo count($emp02)." 】<br/>";
                            //这里应该循环每个人的入职日期，和离职日期，看工作了多少天
                            $work_unit2=array();
                            foreach($emp02 as $k=>$v)
                            {
                                //echo $v['name'].":".substr($v['applydate'],0,10)."_".substr($v['leavedate'],0,10)."<br/>";
                                //如果不是在今年入职的，就计算成今年第一日，用于计算
                                if($v['applydate']<$year_this."-01-01")
                                {
                                    $v['applydate']=$year_this."-01-01";
                                }


                                    $work_unit2[]=count_days($v['applydate'],$v['leavedate']);
                                    //$_work_unit2=count_period($v['applydate'],$v['leavedate']);
                                   // echo "工作天".$_work_unit2[6]."<br/>";
                                    //$work_unit2[]=$_work_unit2[6];


                            }

                            echo array_sum($work_unit2);

                            ?><br/>



                        </td>


                        <td><? echo $total_work_unit=array_sum($work_unit2)+array_sum($work_unit);?></td>






                        <td>
                            <? $emp01=select_lines_all_items($table_Prefix."employee","",
                                "(applydate < '".$year_last."-01-01' or applydate like '%".$year_last."%') and
                                 (leavedate > '".$year_last."-12-31' or leavedate = '0000-00-00 00:00:00')"  ,"") ;?>
                            <?
                            //这里应该循环每个人的入职日期，直到最后一日，看应该计算多少天
                            $work_unit=array();
                            foreach($emp01 as $k=>$v)
                            {
                                // echo $v['name'].":".substr($v['applydate'],0,10)."_".substr($v['leavedate'],0,10)."<br/>";
                                //非此年入职，计算全年
                                if($v['applydate']<$year_last."-01-01")
                                {
                                    $work_unit[]=365;
                                }
                                else//此年入职，需要年末减去入职时间
                                {

                                    $work_unit[]=count_days($v['applydate'],$year_last."-12-31");

                                }

                            }


                            ?>






                            <? $emp02=select_lines_all_items($table_Prefix."employee","","leavedate > '".$year_last."-01-01' and leavedate < '".$year_last."-12-31'"  ,"") ;?>
                            <?
                            //这里应该循环每个人的入职日期，和离职日期，看工作了多少天
                            $work_unit2=array();
                            foreach($emp02 as $k=>$v)
                            {
//                                echo $v['name'].":".substr($v['applydate'],0,10)."_".substr($v['leavedate'],0,10)."<br/>";
                                //如果不是在今年入职的，就计算成今年第一日，用于计算
                                if($v['applydate']<$year_last."-01-01")
                                {
                                    $v['applydate']=$year_last."-01-01";
                                }


                                $work_unit2[]=count_days($v['applydate'],$v['leavedate']);

                            }

                            echo $last_work_total=array_sum($work_unit2)+array_sum($work_unit);

                            ?><br/>




                        </td>



                        <td><? echo $income_this_year;?></td>
                        <td>
                            <?echo $except_income=substr($income_last_year/$last_work_total,0,5)*1.15*$total_work_unit ;?>
                        </td>
                        <td>差距：<?echo $except_income-$income_this_year?><br/>
                            达成：<?echo substr($income_this_year/$except_income/0.01,0,6)?>%
                        </td>

                        <td><?echo $true_work_unit=substr($income_this_year / $total_work_unit,0,5)?> </td>

                        <td><?echo $except_work_unit=substr($income_last_year/$last_work_total,0,5)*1.15 ;?>

                        </td>
                        <td>
                            差距：<?echo $except_work_unit-$true_work_unit?><br/>
                            达成：<?echo substr($true_work_unit/$except_work_unit/0.01,0,5)?>%
                        </td>

                        <td>
                            <?if($ii!=4){?>
                            差距：<?echo $income_this_year-$income_last_year  ;}?><br/>
                            <?if($ii!=4){?>
                            增幅：<?echo substr(($income_this_year-$income_last_year)*100/$income_last_year,0,5)."%";}?>
                        </td>




                    </tr>
                <?}?>




                </tbody>
            </table>
        </div>








    <h2>财政分析</h2>

    <table class="layui-table">

        <thead>
        <tr>
            <th>年度</th>

            <th>当前支出(财务)/酬/提/政</th>
            <th>当前收入(财务)</th>

            <th>净利润</th>
            <th>营业额（项目）</th>
            <th>毛利（项目）</th>
            <th>未收款金额</th>
            <th>烂账金额</th>

            <th>年工资支出预计</th>
            <th>花红池</th>
            <th>人均</th>
        </tr>
        </thead>


        <tbody>
        <tr>
            <td><?echo date("Y")?></td>
            <td>
                <? echo $output=sum_total($table_Prefix."finance","cost","applydate like '".date("Y")."%' and status = '过账'  and cost < 0");?>【
                <? echo sum_total($table_Prefix."finance","cost","classify = '工资支出' and applydate like '".date("Y")."%' and status = '过账'  and cost < 0");?>/
                <? echo sum_total($table_Prefix."finance","cost","classify = '提成支出' and applydate like '".date("Y")."%' and status = '过账'  and cost < 0");?>/
                <? echo sum_total($table_Prefix."finance","cost","classify = '行政支出' and applydate like '".date("Y")."%' and status = '过账'  and cost < 0");?>】
            </td>

            <td><? echo $income=sum_total($table_Prefix."finance","cost","applydate like '".date("Y")."%' and status = '过账'  and cost > 0");?></td>

            <td><? echo  $income+$output;?> </td>
            <td><? echo round(sum_total($table_Prefix."case","sum","paydate like '".date("Y")."%' and status = '完成'"),3);?></td>
            <td><? echo round(sum_total($table_Prefix."case","profit","paydate like '".date("Y")."%' and status = '完成'"),3);?></td>
            <td><? echo round(sum_total($table_Prefix."case","sum","paydate like '".date("Y")."%' and status = '进行中'"),3);?></td>
            <td><? echo round(sum_total($table_Prefix."case","sum","paydate like '".date("Y")."%' and status = '烂账'"),3);?></td>
<!--            <td>-->
<!--                --><?//
//                $employee_cost=select_lines_all_items($table_Prefix."employee","","status = '在职'","");
//                //print_r2(transform_2darray_in_1darray_number_as_key($employee_cost,"salary"));
//                $month_cost=array_sum(transform_2darray_in_1darray_number_as_key($employee_cost,"salary"));
//                echo -$month_cost*12;
//                ?>
<!--            </td>-->
            <td>
                <?echo round(sum_total($table_Prefix."case","profit","paydate like '".date("Y",strtotime("Y"))."%' and status = '完成'"),3)-$month_cost*12 ?>
            </td>
            <td><?echo $income+$output-120000?></td>
			<? 
			//这种直接把收益平均分的方式不对。除非实行第二年开始计算。
			//应该按照参与的项目多少的评分再分配。换句话说，就是提成的再一次计算。
			//或者把收益按照在职时间长短再计算
			//在最后剩余利润的基础上，把所有的支出的提成 和 个人 收到的提成做个对比，然后再分。
			?>
            <td>(误)<?echo ($income+$output-120000)/count(select_lines_all_items($table_Prefix."employee","","status = '在职'",""));?></td>

        </tr>

        <tr>
            <td><?echo date("Y",strtotime("-1 year "))?></td>

            <td><? echo $output=sum_total($table_Prefix."finance","cost","applydate like '".date("Y",strtotime("-1 year "))."%' and status = '过账'  and cost < 0");?>【
                <? echo sum_total($table_Prefix."finance","cost","classify = '工资支出' and applydate like '".date("Y",strtotime("-1 year "))."%' and status = '过账'  and cost < 0");?>/
                <? echo sum_total($table_Prefix."finance","cost","classify = '提成支出' and applydate like '".date("Y",strtotime("-1 year "))."%' and status = '过账'  and cost < 0");?>/
                <? echo sum_total($table_Prefix."finance","cost","classify = '行政支出' and applydate like '".date("Y",strtotime("-1 year "))."%' and status = '过账'  and cost < 0");?>】
            </td>
            <td><? echo $income=sum_total($table_Prefix."finance","cost","applydate like '".date("Y",strtotime("-1 year "))."%' and status = '过账'  and cost > 0");?></td>
           <td><? echo  $income+$output;?> </td>
            <td><? echo round(sum_total($table_Prefix."case","sum","paydate like '".date("Y",strtotime("-1 year "))."%' and status = '完成'"),3)?></td>
            <td><? echo round(sum_total($table_Prefix."case","profit","paydate like '".date("Y",strtotime("-1 year "))."%' and status = '完成'"),3)?></td>

            <td><? echo round(sum_total($table_Prefix."case","sum","paydate like '".date("Y",strtotime("-1 year "))."%' and status = '进行中'"),3)?></td>
            <td><? echo round(sum_total($table_Prefix."case","sum","paydate like '".date("Y",strtotime("-1 year "))."%' and status = '烂账'"),3)?></td>
<!--            <td>-->
<!--                --><?//
//                $employee_cost=select_lines_all_items($table_Prefix."employee","","status = '在职'","");
//                //print_r2(transform_2darray_in_1darray_number_as_key($employee_cost,"salary"));
//                $month_cost=array_sum(transform_2darray_in_1darray_number_as_key($employee_cost,"salary"));
//                echo -$month_cost*12;
//                ?>
<!--            </td>-->
            <td>
             </td>
            <td><?echo $income+$output-120000?></td>
            <td><?echo $income+$output-120000?></td>
        </tr>

        <tr>
            <td><?echo date("Y",strtotime("-2 year "))?></td>

            <td><? echo $output=sum_total($table_Prefix."finance","cost","applydate like '".date("Y",strtotime("-2 year "))."%' and status = '过账'  and cost < 0");?>【
                <? echo sum_total($table_Prefix."finance","cost","classify = '工资支出' and applydate like '".date("Y",strtotime("-2 year "))."%' and status = '过账'  and cost < 0");?>/
                <? echo sum_total($table_Prefix."finance","cost","classify = '提成支出' and applydate like '".date("Y",strtotime("-2 year "))."%' and status = '过账'  and cost < 0");?>/
                <? echo sum_total($table_Prefix."finance","cost","classify = '行政支出' and applydate like '".date("Y",strtotime("-2 year "))."%' and status = '过账'  and cost < 0");?>】
            </td>
            </td>
            <td><? echo $income=sum_total($table_Prefix."finance","cost","applydate like '".date("Y",strtotime("-2 year "))."%' and status = '过账'  and cost > 0");?></td>
            <td><? echo  $income+$output;?> </td>
            <td><? echo round(sum_total($table_Prefix."case","sum","paydate like '".date("Y",strtotime("-2 year"))."%' and status = '完成'"),3)?></td>
            <td><? echo round(sum_total($table_Prefix."case","profit","paydate like '".date("Y",strtotime("-2 year"))."%' and status = '完成'"),3)?></td>

            <td><? echo round(sum_total($table_Prefix."case","sum","paydate like '".date("Y",strtotime("-2 year"))."%'  and status = '进行中'"),3)?></td>
            <td><? echo round(sum_total($table_Prefix."case","sum","paydate like '".date("Y",strtotime("-2 year"))."%'  and status = '烂账'"),3)?></td>


            <?//工资应该要做一个工资记录。每次变更工资都需要记录一个时间段。?>
            <?//工资应该要做一个工资记录。每次变更工资都需要记录一个时间段。?>
            <?//工资应该要做一个工资记录。每次变更工资都需要记录一个时间段。?>


            <td></td>
            <td></td>
            <td></td>



        </tr>



        <tr>
            <td><?echo date("Y",strtotime("-3 year "))?></td>

            <td><? echo $output=sum_total($table_Prefix."finance","cost","applydate like '".date("Y",strtotime("-3 year "))."%' and status = '过账'  and cost < 0");?>【
                <? echo sum_total($table_Prefix."finance","cost","classify = '工资支出' and applydate like '".date("Y",strtotime("-3 year "))."%' and status = '过账'  and cost < 0");?>/
                <? echo sum_total($table_Prefix."finance","cost","classify = '提成支出' and applydate like '".date("Y",strtotime("-3 year "))."%' and status = '过账'  and cost < 0");?>/
                <? echo sum_total($table_Prefix."finance","cost","classify = '行政支出' and applydate like '".date("Y",strtotime("-3 year "))."%' and status = '过账'  and cost < 0");?>】
            </td>
            </td>
            <td><? echo $income=sum_total($table_Prefix."finance","cost","applydate like '".date("Y",strtotime("-3 year "))."%' and status = '过账'  and cost > 0");?></td>
            <td><? echo  $income+$output;?> </td>
            <td><? echo round(sum_total($table_Prefix."case","sum","paydate like '".date("Y",strtotime("-3 year"))."%' and status = '完成'"),3)?></td>
            <td><? echo round(sum_total($table_Prefix."case","profit","paydate like '".date("Y",strtotime("-3 year"))."%' and status = '完成'"),3)?></td>

            <td><? echo round(sum_total($table_Prefix."case","sum","paydate like '".date("Y",strtotime("-3 year"))."%'  and status = '进行中'"),3)?></td>
            <td><? echo round(sum_total($table_Prefix."case","sum","paydate like '".date("Y",strtotime("-3 year"))."%'  and status = '烂账'"),3)?></td>

            <td></td>
            <td></td>
            <td></td>



        </tr>





        <tr>
            <td><?echo date("Y",strtotime("-4 year "))?></td>

            <td><? echo $output=sum_total($table_Prefix."finance","cost","applydate like '".date("Y",strtotime("-4 year "))."%' and status = '过账'  and cost < 0");?>【
                <? echo sum_total($table_Prefix."finance","cost","classify = '工资支出' and applydate like '".date("Y",strtotime("-4 year "))."%' and status = '过账'  and cost < 0");?>/
                <? echo sum_total($table_Prefix."finance","cost","classify = '提成支出' and applydate like '".date("Y",strtotime("-4 year "))."%' and status = '过账'  and cost < 0");?>/
                <? echo sum_total($table_Prefix."finance","cost","classify = '行政支出' and applydate like '".date("Y",strtotime("-4 year "))."%' and status = '过账'  and cost < 0");?>】
            </td>
            </td>
            <td><? echo $income=sum_total($table_Prefix."finance","cost","applydate like '".date("Y",strtotime("-4 year "))."%' and status = '过账'  and cost > 0");?></td>
            <td><? echo  $income+$output;?> </td>
            <td><? echo round(sum_total($table_Prefix."case","sum","paydate like '".date("Y",strtotime("-4 year"))."%' and status = '完成'"),3)?></td>
            <td><? echo round(sum_total($table_Prefix."case","profit","paydate like '".date("Y",strtotime("-4 year"))."%' and status = '完成'"),3)?></td>

            <td><? echo round(sum_total($table_Prefix."case","sum","paydate like '".date("Y",strtotime("-4 year"))."%'  and status = '进行中'"),3)?></td>
            <td><? echo round(sum_total($table_Prefix."case","sum","paydate like '".date("Y",strtotime("-4 year"))."%'  and status = '烂账'"),3)?></td>

            <td></td>
            <td></td>
            <td></td>



        </tr>


        </tbody>
    </table>







<!---->
<!--    <h2>年度分红计划</h2>-->
<!--    <div class="shrinker" >年度分红计划，多种统计因素综合。</div>-->
<!--    <div class="layui-form">-->
<!--        <table class="layui-table">-->
<!--            <colgroup>-->
<!--                <col width="100">-->
<!--                <col>-->
<!--                <col>-->
<!--                <col>-->
<!--                <col>-->
<!--            </colgroup>-->
<!--            <thead>-->
<!--            <tr>-->
<!--                <th>年度</th>-->
<!--                <th>员工</th>-->
<!--                <th>迟到</th>-->
<!--                <th>早退</th>-->
<!--                <th>请假</th>-->
<!--                <th>项目评分</th>-->
<!--                <th>红点</th>-->
<!--                <th>花红</th>-->
<!--            </tr>-->
<!--            </thead>-->
<!--            <tbody>-->
<!---->
<!--            --><?//
//
//
//            for($ii=0;$ii<4;$ii++){?>
<!--                <tr>-->
<!--                    <td>2020</td>-->
<!--                    <td>员工</td>-->
<!--                    <td>迟到</td>-->
<!--                    <td>早退</td>-->
<!--                    <td>请假</td>-->
<!--                    <td>项目评分</td>-->
<!--                    <td>红点</td>-->
<!--                    <td>红点</td>-->
<!--                </tr>-->
<!--            --><?//}?>
<!---->
<!---->
<!---->
<!---->
<!--            </tbody>-->
<!--        </table>-->
<!--    </div>-->
<!---->
<!---->









    <h2>月收支统计</h2>
    <div class="shrinker" >收入是财务信息中的。但是后面的具体的项目类型收入计算的是计算当月完成的项目的利润。此部分需要修改。因为出的利润会和财政收入重复计算</div>



    <!-- 这个是图标 -->
    <div id="month_ehart" style="width: 100%;height:400px;"></div>




    <div class="layui-form">
        <table class="layui-table">
            <colgroup>
                <col width="100">
                <col>
                <col>
                <col>
                <col>
            </colgroup>
            <thead>
            <tr>
                <th>日期</th>
                <th>收入</th>
                <th>支出</th>
                <th>盈利</th>

                <th>工资</th>
                <th>提成</th>
                <th>行政</th>
                <th>广告工程</th>
                <th>平面设计</th>
                <th>微信推广</th>
                <th>活动策划</th>
                <th>微信平台</th>
                <th>网站开发</th>
                <th>系统开发</th>
                <th>微信广告</th>
                <th>工业设计</th>
                <th>视频媒体</th>
                <th>室内设计</th>

            </tr>
            </thead>
            <tbody>

            <?

            date_default_timezone_set('Asia/Shanghai');
            $first_day_of_month = date('Y-m',time()) . '-01 00:00:01';
            $t = strtotime($first_day_of_month);

            for($ii=0;$ii<14;$ii++){?>
                <tr>
                    <td>
                        <? $echart_month[]= date("Y-m",strtotime("-$ii months",$t))?>
                        <?echo date("Y-m",strtotime("-$ii months",$t))?>
                    </td>
<td><? echo $month_income[]=sum_total($table_Prefix."finance","cost","applydate like '".date("Y-m",strtotime("-$ii month ",$t))."%' and status = '过账'  and cost > 0");?></td>
<td><? echo $month_outport[]=sum_total($table_Prefix."finance","cost","applydate like '".date("Y-m",strtotime("-$ii month ",$t ))."%' and status = '过账'  and cost < 0");?></td>

<?$month_profit[]=$profit=sum_total($table_Prefix."finance","cost","applydate like '".date("Y-m",strtotime("-$ii month ",$t))."%' and status = '过账' ")?>
<?if($profit>0){$looklike="red";}else{$looklike="green";}?>
<td style="color:<?echo $looklike?>"><? echo $profit;?></td>

<td><? echo sum_total($table_Prefix."finance","cost","classify = '工资支出' and applydate like '".date("Y-m",strtotime("-$ii month ",$t))."%' and status = '过账' ");?></td>
<td><? echo sum_total($table_Prefix."finance","cost","classify = '提成支出' and applydate like '".date("Y-m",strtotime("-$ii month ",$t))."%' and status = '过账' ");?></td>
<td><? echo sum_total($table_Prefix."finance","cost","classify = '行政支出' and applydate like '".date("Y-m",strtotime("-$ii month ",$t))."%' and status = '过账' ");?></td>
<td><? echo sum_total($table_Prefix."case","profit","paydate like '".date("Y-m",strtotime("-$ii month ",$t))."%' and status = '完成' and type='广告工程' ");?></td>
<td><? echo sum_total($table_Prefix."case","profit","paydate like '".date("Y-m",strtotime("-$ii month ",$t))."%' and status = '完成' and type='平面设计' ");?></td>
<td><? echo sum_total($table_Prefix."case","profit","paydate like '".date("Y-m",strtotime("-$ii month ",$t))."%' and status = '完成' and type='微信推广' ");?></td>
<td><? echo sum_total($table_Prefix."case","profit","paydate like '".date("Y-m",strtotime("-$ii month ",$t))."%' and status = '完成' and type='活动策划' ");?></td>
<td><? echo sum_total($table_Prefix."case","profit","paydate like '".date("Y-m",strtotime("-$ii month ",$t))."%' and status = '完成' and type='微信平台' ");?></td>
<td><? echo sum_total($table_Prefix."case","profit","paydate like '".date("Y-m",strtotime("-$ii month ",$t))."%' and status = '完成' and type='网站开发' ");?></td>
<td><? echo sum_total($table_Prefix."case","profit","paydate like '".date("Y-m",strtotime("-$ii month ",$t))."%' and status = '完成' and type='系统开发' ");?></td>
<td><? echo sum_total($table_Prefix."case","profit","paydate like '".date("Y-m",strtotime("-$ii month ",$t))."%' and status = '完成' and type='微信广告' ");?></td>
<td><? echo sum_total($table_Prefix."case","profit","paydate like '".date("Y-m",strtotime("-$ii month ",$t))."%' and status = '完成' and type='工业设计' ");?></td>
<td><? echo sum_total($table_Prefix."case","profit","paydate like '".date("Y-m",strtotime("-$ii month ",$t))."%' and status = '完成' and type='视频媒体' ");?></td>
<td><? echo sum_total($table_Prefix."case","profit","paydate like '".date("Y-m",strtotime("-$ii month ",$t))."%' and status = '完成' and type='室内设计' ");?></td>
                </tr>
            <?}?>




            </tbody>
        </table>
    </div>











    <h2>收入分析</h2>

    <table class="layui-table">

        <thead>
        <tr>
            <th>预测支出</th>
            <th>当前支出</th>
            <th>当前收入</th>
            <th>营业额</th>
            <th>利润</th>
            <th>利润</th>
            <th>未收款金额</th>
            <th>烂账金额</th>
            <th>最优收款金额</th>
        </tr>
        </thead>


        <tbody>
        <tr>
            <td><?echo $total_user?></td>
            <td><?echo $total_order?></td>
            <td><?echo $total_zaocan?></td>
            <td><?echo $total_zaocan?></td>
            <td><?echo $total_zaocan?></td>
            <td><?echo $total_zaocan?></td>
            <td><?echo $total_zaocan?></td>
            <td><?echo $total_zaocan?></td>
            <td><?echo $total_zaocan?></td>
        </tr>
        </tbody>
    </table>





    <h2>支出分析</h2>

    <table class="layui-table">

        <thead>
        <tr>
            <th>预测支出</th>
            <th>当前支出</th>
            <th>当前收入</th>
            <th>营业额</th>
            <th>利润</th>
            <th>利润</th>
            <th>未收款金额</th>
            <th>烂账金额</th>
            <th>最优收款金额</th>
        </tr>
        </thead>


        <tbody>
        <tr>
            <td><?echo $total_user?></td>
            <td><?echo $total_order?></td>
            <td><?echo $total_zaocan?></td>
            <td><?echo $total_zaocan?></td>
            <td><?echo $total_zaocan?></td>
            <td><?echo $total_zaocan?></td>
            <td><?echo $total_zaocan?></td>
            <td><?echo $total_zaocan?></td>
            <td><?echo $total_zaocan?></td>
        </tr>
        </tbody>
    </table>












</div>
</div>


                <!--list-box end-->
            </div>

            <!--content端點01-->
        </div>
        <!--maincontent端點01-->
        <br class="clearfloat"/>
    </div>
    <!--container端點01-->
</div>



<? $echart_month_srt=implode(array_reverse($echart_month),"','")?>
<?// $echart_income_srt=implode($month_income,"','")?>
<?// $echart_outport_srt=implode($month_outport,"','")?>
<? $echart_profit_srt=implode(array_reverse($month_profit),",")?>





<script type="text/javascript">
    // 基于准备好的dom，初始化echarts实例
    var myChart = echarts.init(document.getElementById('month_ehart'));

    // 指定图表的配置项和数据
    var option = {
        title: {
            text: ''
        },
        tooltip: {},
        legend: {
            data: ['收支','收入','支出']
        },
        xAxis: {
            data: ['<?echo $echart_month_srt?>']
        },
        yAxis: {},
        series: [
            {
                name: '收支',
                type: 'bar',
                data: [<?echo $echart_profit_srt?>]
            }
        ]
    };

    // 使用刚指定的配置项和数据显示图表。
    myChart.setOption(option);
</script>









<?php include ROOT_PATH_ . "/controller/common/module/footer.php"; ?> </body>
</html>
